🌎 rns.kin.earth git 🌍
Commit 873f049e206b9c8a40c716f7d551a80418a9bdb7
Parents : 2ea963e
Author : Mark Qvist <mark@unsigned.io>
Date : 2023-11-02T04:35:57+01:00
Fixed redundant rediscovery path request
Changes
4 files changed, 22 insertions(+), 9 deletions(-)
Diff
diff --git a/RNS/Interfaces/Android/RNodeInterface.py b/RNS/Interfaces/Android/RNodeInterface.py
index dac59265..cb71c6c3 100644
--- a/RNS/Interfaces/Android/RNodeInterface.py
+++ b/RNS/Interfaces/Android/RNodeInterface.py
@@ -1170,7 +1170,7 @@ class RNodeInterface(Interface):
if got == 0:
time_since_last = int(time.time()*1000) - last_read_ms
if len(data_buffer) > 0 and time_since_last > self.timeout:
- RNS.log(str(self)+" serial read timeout", RNS.LOG_DEBUG)
+ RNS.log(str(self)+" serial read timeout", RNS.LOG_WARNING)
data_buffer = b""
in_frame = False
command = KISS.CMD_UNKNOWN
diff --git a/RNS/Interfaces/RNodeInterface.py b/RNS/Interfaces/RNodeInterface.py
index 07f5c502..d15178e2 100644
--- a/RNS/Interfaces/RNodeInterface.py
+++ b/RNS/Interfaces/RNodeInterface.py
@@ -799,7 +799,7 @@ class RNodeInterface(Interface):
else:
time_since_last = int(time.time()*1000) - last_read_ms
if len(data_buffer) > 0 and time_since_last > self.timeout:
- RNS.log(str(self)+" serial read timeout", RNS.LOG_DEBUG)
+ RNS.log(str(self)+" serial read timeout", RNS.LOG_WARNING)
data_buffer = b""
in_frame = False
command = KISS.CMD_UNKNOWN
diff --git a/RNS/Reticulum.py b/RNS/Reticulum.py
index d9baa707..496f5c8d 100755
--- a/RNS/Reticulum.py
+++ b/RNS/Reticulum.py
@@ -119,7 +119,7 @@ class Reticulum:
# TODO: Let Reticulum somehow continously build a map of per-hop
# latencies and use this map for global timeout calculation.
- DEFAULT_PER_HOP_TIMEOUT = 4
+ DEFAULT_PER_HOP_TIMEOUT = 6
# Length of truncated hashes in bits.
TRUNCATED_HASHLENGTH = 128
diff --git a/RNS/Transport.py b/RNS/Transport.py
index 1cff195d..8f039104 100755
--- a/RNS/Transport.py
+++ b/RNS/Transport.py
@@ -305,7 +305,8 @@ class Transport:
@staticmethod
def jobs():
outgoing = []
- path_requests = []
+ path_requests = {}
+ blocked_if = None
Transport.jobs_running = True
try:
@@ -333,7 +334,7 @@ class Transport:
if time.time() - last_path_request > Transport.PATH_REQUEST_MI:
RNS.log("Trying to rediscover path for "+RNS.prettyhexrep(link.destination.hash)+" since an attempted link was never established", RNS.LOG_DEBUG)
if not link.destination.hash in path_requests:
- path_requests.append(link.destination.hash)
+ path_requests[link.destination.hash] = None
Transport.pending_links.remove(link)
@@ -482,14 +483,16 @@ class Transport:
elif not path_request_throttle and Transport.hops_to(link_entry[6]) == 1:
RNS.log("Trying to rediscover path for "+RNS.prettyhexrep(link_entry[6])+" since an attempted link was never established, and destination was previously local to an interface on this instance", RNS.LOG_DEBUG)
path_request_conditions = True
+ blocked_if = link_entry[4]
- # If the link initiator was previously only 1 hop
- # away, this likely means that network topology has
+ # If the link initiator is only 1 hop away,
+ # this likely means that network topology has
# changed. In that case, we try to discover a new path,
# and mark the old one as potentially unresponsive.
elif not path_request_throttle and lr_taken_hops == 1:
RNS.log("Trying to rediscover path for "+RNS.prettyhexrep(link_entry[6])+" since an attempted link was never established, and link initiator is local to an interface on this instance", RNS.LOG_DEBUG)
path_request_conditions = True
+ blocked_if = link_entry[4]
if RNS.Reticulum.transport_enabled():
if hasattr(link_entry[4], "mode") and link_entry[4].mode != RNS.Interfaces.Interface.Interface.MODE_BOUNDARY:
@@ -497,7 +500,7 @@ class Transport:
if path_request_conditions:
if not link_entry[6] in path_requests:
- path_requests.append(link_entry[6])
+ path_requests[link_entry[6]] = blocked_if
if not RNS.Reticulum.transport_enabled():
# Drop current path if we are not a transport instance, to
@@ -652,7 +655,17 @@ class Transport:
packet.send()
for destination_hash in path_requests:
- Transport.request_path(destination_hash)
+ blocked_if = path_requests[destination_hash]
+ if blocked_if == None:
+ Transport.request_path(destination_hash)
+ else:
+ for interface in Transport.interfaces:
+ if interface != blocked_if:
+ # RNS.log("Transmitting path request on "+str(interface), RNS.LOG_DEBUG)
+ Transport.request_path(destination_hash, on_interface=interface)
+ else:
+ pass
+ # RNS.log("Blocking path request on "+str(interface), RNS.LOG_DEBUG)
@staticmethod
def transmit(interface, raw):
Served by rngit 1.5.2 - Generated in 0.08s